blob: eaea03e03844980bd9ee1d607289750aac549916 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
---
import '../../styles/thread.css'
import '../../styles/blackbox.css'
import ThreadLayout from '../../layouts/ThreadLayout.astro';
import Thread from '../../components/Thread.astro'
import type Thread from '../../models/Thread';
import { api } from '../../lib/api.ts';
import { processThreadIn } from '../../lib/thread'
const { board } = Astro.params;
const data = await api('get', `board/${board}`);
if(data.status === 404) return Astro.redirect('/404');
const threads: Thread[] = await data.json();
for(let thread of threads)
await processThreadIn(board, thread);
---
<ThreadLayout>
<h1 style="text-align:center">
<a href=`/boards`>{board}</a>
</h1>
<div class="blackbox">
<button style="left: 50%; position: relative; transform: translate(-50%, 0);" onclick=`window.location='/create/${board}'`>Create Thread</button>
</div>
{threads.map((thread) => (
<Thread thread={thread} board={board} />
))}
</ThreadLayout>
|